package datasources.c3p0;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

public class C3P0Demo1 {
    public static void main(String[] args) throws SQLException {
        //1. 创建连接池
        DataSource ds = new ComboPooledDataSource("otherc3p0");
        System.out.println();
        //2. 获取连接对象
        Connection conn = ds.getConnection();
        ResultSet rs = conn.createStatement().executeQuery("select * from account");
        rs.next();
        System.out.println(rs.getInt(1));


    }
}
